<?php

namespace common\validate;
class Entity extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this->append('module_code', 'require');
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data', 'require|array')
            ->append('module_code', 'require');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data', 'require|array')
            ->append('data.name', 'max:128')
            ->append('data.remark', 'max:512')
            ->append('module_code', 'require');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // AutoScheduling 验证场景定义
    public function sceneAutoScheduling()
    {
        return $this
            ->append('param.filter.project_id', 'require|integer')
            ->append('param.filter.step_category_id', 'require|integer');
    }

    // GenerateEntityStepCategoryTask 验证场景定义
    public function sceneGenerateEntityStepCategoryTask()
    {
        return $this->append('project_id', 'require')
            ->append('module_code', 'require');
    }

    // CreateDesign 验证场景定义
    public function sceneCreateDesign()
    {
        return $this->append('data.project_id', 'require')
            ->append("data.name", 'require|regex:/^[\dA-Za-z\~\!\@\#\\$\%\^\&\*\(\)\_\+\{\}\:\<\>\?\[\]\\.\;\'\`\-\=\\\\\x7f-\xff+]+$/')
            ->append("data.showings_number", 'require')
            ->append("data.initial_episode_code", 'require')
            ->append('module_code', 'require');
    }

    // CreateAsset 验证场景定义
    public function sceneCreateAsset()
    {
        return $this->append("data", "require")
            ->append("data.name", 'require')
            ->append("data.project_id", 'require')
            ->append("data.asset_grade", 'require')
            ->append("data.asset_style", 'require')
            ->append("data.asset_category", 'require')
            ->append("data.step_workflow_id", 'require|integer')
            ->append("data.description", 'max:2048')
            ->append("module_code", 'require|max:128');
    }

    // GetEntityWorkFlowId 验证场景定义
    public function sceneGetEntityWorkFlowId()
    {
        return $this->append("param", "require")
            ->append("param.project_id", 'require');
    }

    // CreateShot 验证场景定义
    public function sceneCreateShot()
    {
        return $this->append("data", "require")
            ->append("data.name", 'require')
            ->append("data.project_id", 'require')
            ->append("data.shot_type", 'require')
            ->append("data.shot_style", 'require')
            ->append("data.shot_duration", 'require')
            ->append("data.shot_perform_form", 'require')
            ->append("data.shot_perform_numbers", 'require')
            ->append("data.shot_perform_species", 'require')
            ->append("data.shot_production_method", 'require')
            ->append("data.initial_episode_code", 'require') //集名称
            ->append("data.step_workflow_id", 'require|integer') //工序流
            ->append("data.entity_id", 'require|integer') //关联的序列id
            ->append("data.entity_module_id", 'require|integer') //关联的序列模块id
            ->append("data.description", 'max:2048')
            ->append("module_code", 'require|max:128');
    }

    // CreateLevel 验证场景定义
    public function sceneCreateLevel()
    {
        return $this->append("data", "require")
            ->append("data.name", 'require')
            ->append("data.project_id", 'require')
            ->append("data.level_grade", 'require')
            ->append("data.level_style", 'require')
            ->append("data.step_workflow_id", 'require|integer') //工序流
            ->append("data.description", 'max:2048')
            ->append("module_code", 'require|max:128');
    }

    // CreateSequence 验证场景定义
    public function sceneCreateSequence()
    {
        return $this->append("data", "require")
            ->append("data.name", 'require')
            ->append("data.project_id", 'require')
            ->append("data.step_workflow_id", 'require|integer') //工序流
            ->append("data.description", 'max:2048')
            ->append("data.episode_name", 'require|max:128')
            ->append("data.sequence_style", 'require')
            ->append("data.sequence_duration", 'require')
            ->append("data.sequence_perform_form", 'require')
            ->append("data.sequence_perform_numbers", 'require')
            ->append("data.sequence_perform_species", 'require')
            ->append("data.sequence_production_method", 'require')
            ->append("module_code", 'require|max:128');
    }

    // CreateEpisode 验证场景定义
    public function sceneCreateEpisode()
    {
        return $this->append("data", "require")
            ->append("data.name", 'require')
            ->append("data.project_id", 'require')
            ->append("data.description", 'max:2048')
            ->append("module_code", 'require|max:128');
    }

    // AutoEntityListRelate 验证场景定义
    public function sceneAutoEntityListRelate()
    {
        return $this->append("project_id", 'require');
    }

    // GenerateAssetAndLevelByDesign 验证场景定义
    public function sceneGenerateAssetAndLevelByDesign()
    {
        return $this->append("project_id", 'require')
            ->append('param.filter', 'array');
    }

    // GenerateShotByStoryboard 验证场景定义
    public function sceneGenerateShotByStoryboard()
    {
        return $this->append("project_id", 'require')
            ->append('param.filter', 'array');
    }

    // Publish 验证场景定义
    public function scenePublish()
    {
        return $this->append('param.filter', 'require|array')
//            ->append('param.generate_relate_entity_and_task', 'require|in:yes,no')
            ->append('module_code', 'require');
    }

    // AssemblySequence 验证场景定义
    public function sceneAssemblySequence()
    {
        return $this->append('param.filter', 'require|array')
            ->append('data', 'require|array')
//            ->append('data.project_id', 'require') // 集id
            ->append('data.initial_episode_code', 'require') // 集code
            ->append('data.showings_number', 'require') // 场次信息
            ->append('data.sequence_name', 'require') // 序列名称
            ->append('data.production_method', 'require') // 制作方式
            ->append('data.cloth_solution', 'require') // 解算方式
            ;
    }

    // UpdateEntityMediaInfo 验证场景定义
    public function sceneUpdateEntityMediaInfo()
    {
        return $this->append('data.id', 'require')
            ->append('data.medias', 'array');
    }

    // SyncRelationData 验证场景定义
    public function sceneSyncRelationData()
    {
        return $this->append('param.filter', 'require|array');
    }

    // StatusList 验证场景定义
    public function sceneStatusList()
    {
        return $this->append('module_code', 'require');
    }

    // Submit 验证场景定义
    public function sceneSubmit()
    {
        return $this->append('param.filter', 'require');
    }

    // Import 验证场景定义
    public function sceneImport()
    {
        return $this->append('data_list', 'require|array');
    }

    // ImportItem 验证场景定义
    public function sceneImportItem()
    {
        return $this->append('name', 'require|max:128')
            ->append('project_id', 'require|integer');
    }

    // RemoveSequence 验证场景定义
    public function sceneRemoveSequence()
    {
        return $this->append('param.filter', 'require|array');
    }

    // Import 验证场景定义
    public function sceneScriptImport()
    {
        return $this->append('data_list', 'require|array');
    }

    // ImportItem 验证场景定义
    public function sceneScriptImportItem()
    {
        return $this->append('name', 'require|max:128')
            ->append('project_id', 'require|integer')
            ->append('episode_id', 'require|integer')
            ->append('showings_number', 'require')
            ->append('design_category', 'require');
    }

    // UpdateDesignRelation 验证场景定义
    public function sceneUpdateDesignRelation()
    {
        return $this->append('data.id|当前概念id', 'require|integer')
            ->append('data.related_level|关联关卡', 'array')
            ->append('data.related_asset|关联资产', 'array');
    }

    // UpdateSequence 验证场景定义
    public function sceneUpdateSequence()
    {
        return $this->append('data.project_id', 'require')
            ->append('data.initial_episode_code', 'require') // 集code
            ->append('data.showings_number', 'require') // 场次信息
            ->append('data.sequence_name', 'require') // 序列名称
            ->append('data.production_method', 'require') // 制作方式
            ->append('data.cloth_solution', 'require'); // 解算方式
    }

    // ModifyAndRegenerateTask 验证场景定义
    public function sceneModifyAndRegenerateTask()
    {
        return $this->append('data.id', 'require');
    }

    // GetAssignPopTaskTree 验证场景定义
    public function sceneGetAssignPopTaskTree()
    {
        return $this
            ->append('param.filter.task_ids', 'require|array');
    }

    //sequence 验证场景定义
    public function sceneModifySequenceTask()
    {
        return $this->append('data', 'require')
            ->append('data.sequence_data', 'require')
            ->append('data.shot_data', 'require');
    }

    // BatchUpdate 验证场景定义
    public function sceneBatchUpdate()
    {
        $this->append('data_list', 'require|array');
    }

    // BatchUpdateSame 验证场景定义
    public function sceneBatchUpdateSame()
    {
        $this->append('data.id', 'require|array');
    }

    // BatchUpdateItem 验证场景定义
    public function sceneBatchUpdateItem()
    {
        $this->append('id', 'require|integer');
    }

    // SyncEpisodeRelationToAsset 验证场景定义
    public function sceneSyncEpisodeRelationToAsset()
    {
        return $this->append('param.filter.project_id', 'require|integer');
    }

    // GetAssetMergeModuleEntityTaskTree 验证场景定义
    public function sceneGetAssetMergeModuleEntityTaskTree()
    {
        return $this->append('param.filter.project_id', 'require|integer');
    }

    // GetShotMergeModuleEntityTaskTree 验证场景定义
    public function sceneGetShotMergeModuleEntityTaskTree()
    {
        return $this->append('param.filter.project_id', 'require|integer');
    }

    // AssetSearchRecommend 验证场景定义
    public function sceneAssetSearchRecommend()
    {
        return $this->append('param.filter.project_id', 'require|integer')
            ->append('param.limit', 'require|integer');
    }

    public function sceneGetGenerateEntityTaskList()
    {
        return $this->append('param.filter', 'array');
    }

    // GetShotEntityTaskTree 验证场景定义
    public function sceneGetShotEntityTaskTree()
    {
        return $this->append('param.filter.project_id', 'require|integer');
    }

    // AssembleMotionSequence 验证场景定义
    public function sceneAssembleMotionSequence()
    {
        return $this->append('data.storyboard_id', 'require|array')
            ->append('data.sequence_data', 'require|array')
            ->append('data.sequence_data.name', 'require|max:128');
    }

    // MotionSequenceList 验证场景定义
    public function sceneMotionSequenceList()
    {
        return $this->append('module_code', 'require')
            ->append('param.filter', 'require|array')
            ->append('param.page', 'array');
    }

    // MotionSequence 验证场景定义
    public function sceneMotionSequence()
    {
        return $this->append('module_code', 'require')
            ->append('param.filter', 'require|array');
    }

    public function sceneGetMaxSequenceName()
    {
        return $this->append('param.filter', 'require|array')
            ->append('param.filter.project_id', 'require');
    }

    public function sceneModifyShotEntityStep()
    {
        return $this->append('data.id', 'require');
    }

    // CreateTodoTask 验证场景定义
    public function sceneCreateTodoTask()
    {
        return $this->append('data.name', 'require')
            ->append('data.entity_id', 'require|integer');
    }

    // DeleteTodoTask 验证场景定义
    public function sceneDeleteTodoTask()
    {
        return $this->append('param.id', 'require|integer');
    }

    // DeprecateTodoTask 验证场景定义
    public function sceneDeprecateTodoTask()
    {
        return $this->append('param.id', 'require|integer');
    }

    // EnableTodoTask 验证场景定义
    public function sceneEnableTodoTask()
    {
        return $this->append('param.id', 'require|integer');
    }

    // BatchCreateTodoTask 验证场景定义
    public function sceneBatchCreateTodoTask()
    {
        return $this->append('data_list', 'require|array');
    }

    // BatchCreateTodoTaskItem 验证场景定义
    public function sceneBatchCreateTodoTaskItem()
    {
        return $this->append('name', 'require')
            ->append('entity_id', 'require|integer')
            ->append('id', 'integer');
    }

    // RelateTodoTask 验证场景定义
    public function sceneRelateTodoTask()
    {
        return $this
            ->append('data.storyboard_id_list', 'require|array')
            ->append('data.entity_id', 'require|integer')
            ->append('data.todo_task_id', 'require|integer');
    }

    //FindEntityStepList 验证场景定义
    public function sceneFindEntityStepList()
    {
        return $this->append('param.filter', 'require|array')
            ->append('param.filter.entity_id', 'require');
    }

    //FindEntityStepTaskSchedule 验证场景定义
    public function sceneFindEntityStepTaskSchedule()
    {
        return $this->append('param.filter', 'require|array')
            ->append('param.filter.entity_code', 'require')
            ->append('param.filter.project_id', 'require')
            ->append('param.filter.initial_episode_code', 'requireIf:module_code,storyboard')
            ->append('param.filter.showings_number', 'requireIf:module_code,storyboard');
    }

    //FindMotionSequenceTask 验证场景定义
    public function sceneFindMotionSequenceTask()
    {
        return $this->append('param.filter', 'require|array')
            ->append('param.filter.entity_id', 'require');
    }

    public function sceneSearchEpisodeEntityStepList()
    {
        return $this->append('param.filter', 'require|array');
    }

    // GetUnknownEntity 验证场景定义
    public function sceneGetUnknownEntity()
    {
        return $this->append('param.filter', 'require|array');
    }

    // SetEpisodeSealOrShow 验证场景定义
    public function sceneSetEpisodeSealOrShow()
    {
        return $this->append('data.id', 'require|integer')
            ->append('data.type', 'require|in:seal,show')
            ->append('data.is_seal', 'in:yes,no')
            ->append('data.is_show', 'in:yes,no');
    }

    // sceneGetUseInfo 验证场景定义
    public function sceneGetUseInfo()
    {
        return $this->append('param.entity_ids', 'require');
    }

    public function sceneSaveMotionSequence()
    {
        return $this->append('data.storyboard_id', 'array')
            ->append('data.sequence_data', 'require');
    }

    public function sceneCreateMotionSequence()
    {
        return $this->append('sequence_data.name', 'require')
            ->append('sequence_data.project_id', 'require')
            ->append('sequence_data.initial_episode_code', 'require')
            ->append('sequence_data.showings_number', 'require');
    }

    public function sceneUpdateMotionSequence()
    {
        return $this->append('sequence_data.id', 'require');
    }

    public function sceneRevokeMotionSequenceStoryboard()
    {
        return $this->append('param.filter.storyboard_ids', 'require');
    }

    public function sceneFindSequenceStoryboardAsset()
    {
        return $this->append('param.filter.sequence_id', 'require');
    }

    // StatusCheck 验证场景定义
    public function sceneStatusCheck()
    {
        return $this->append('param.id', 'require|integer');
    }

    // SyncRelationShips 验证场景定义
    public function sceneSyncRelationShips()
    {
        return $this->append('param.id', 'require|integer');
    }

    // GetAbnormalEntityStepCategoryList 验证场景定义
    public function sceneGetAbnormalEntityStepCategoryList()
    {
        return $this->append('param.entity_ids', 'require|array');
    }

    // GetAbnormalEntityDelayConfirmList 验证场景定义
    public function sceneGetAbnormalEntityDelayConfirmList()
    {
        return $this->append('param.task_ids', 'require|array');
    }
}
